package com.lxhll.personnel.controller;

import com.lxhll.personnel.core.ResponseData;
import com.lxhll.personnel.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/statistics")
public class StatisticsController {
    @Autowired
    private DepartmentService departmentService;


    /**
     * 统计选择月份的每个部门的总人数，默认为当前月
     * @param
     * @return
     */
    @GetMapping("/department_number")
    public ResponseData deNum(){
        return ResponseData.ok(departmentService.statisticsEmployeeNumber());
    }

    /**
     * 统计选择月份的每个部门的总人数，默认为当前月
     * @param
     * @return
     */
    @GetMapping("/details/{date}")
    public ResponseData deNum(@PathVariable String date){
        return ResponseData.ok(departmentService.statisticsDetails(date));
    }
}
